#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5e5 + 5;

int n, m;
int a[N];
int bit[N];
int lowbit(int x) { return x & -x; }
void update(int x, int k) {
  for (int i = x; i <= n; i += lowbit(i)) bit[i] += k;
}
int query(int x) {
  int sum = 0;
  for (int i = x; i > 0; i -= lowbit(i)) sum += bit[i];
  return sum;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) cin >> a[i];
  rep(i, 1, n) update(i, a[i] - a[i - 1]);
  while (m--) {
    int op, x, y, k;
    cin >> op;
    if (op == 1) {
      cin >> x >> y >> k;
      update(x, k), update(y + 1, -k);
    } else {
      cin >> x;
      cout << query(x) << endl;
    }
  }
  return 0;
}